<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改资源配置')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-resources-edit" th:object="${devOpsResourcesInfo}">

            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">uuid：</label>
                <div class="col-sm-8">
                    <input name="uuid" th:field="*{uuid}" class="form-control" type="text" readonly="readonly" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">资源所属环境：</label>
                <div class="col-sm-8">
                    <input name="resenvcode" th:field="*{resenvcode}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">主机/IP：</label>
                <div class="col-sm-8">
                    <input name="reshost" th:field="*{reshost}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">用户名：</label>
                <div class="col-sm-8">
                    <input name="resusername" th:field="*{resusername}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">密码：</label>
                <div class="col-sm-8">
                    <input name="respassword" th:field="*{respassword}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">端口：</label>
                <div class="col-sm-8">
                    <input name="resport" th:field="*{resport}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">remark：</label>
                <div class="col-sm-8">
                    <input name="remark" th:field="*{remark}" class="form-control" type="text">
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "devops/resources";
        $("#form-resources-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-resources-edit').serialize());
            }
        }

        function getEnvList(){
            $.ajax({
                cache : true,
                type : "POST",
                url : ctx + "devops/env/list",
                data : {
                },
                async : false,
                error : function(request) {
                    $.modal.alertError("系统错误");
                },
                success : function(data) {
                    var depart_list = data.rows;
                    var opts = "";
                    for( var depart_index = 0 ; depart_index < depart_list.length; depart_index++ ){
                        var depart = depart_list[depart_index];
                        opts += "<option value='"+envCode+"'>"+envMsg+"</option>";
                    }
                    // 查询界面
                    $("#envList").append(opts);
                    $("#envList").selectpicker("refresh");
                }
            });
        }

        getEnvList();
    </script>
</body>
</html>